//part1:C03:ex3.43.cpp 
//output elements of array.
#include <iostream>

int main(void)
{
    using namespace std;
    int ia[3][4] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
    cout << "for statement output elements of ia:\n";
    for (int (&row)[4] : ia)
    {
        for (int &col : row)
        {
            cout << col << " ";
        }
        cout << endl;
    }

    cout << "for statement index, output elements of ia:\n";
    for (int i = 0; i != 3; i++)
    {
        for (int j = 0; j != 4; j++)
        {
            cout << ia[i][j] << " ";
        }
        cout << endl;
    }

    cout << "for statement pointer, output elements of ia:\n";
    for (int (*p)[4] = ia; p != ia + 3; p++)
    {
        for (int *pcol = *p; pcol != *p + 4; pcol++)
        {
            cout << *pcol << " ";
        }
        cout << endl;
    }
    
    return 0;
}